<?php

namespace app\admin\model;

use think\Model;

/**
 * Order
 * @controllerUrl 'orderGoods'
 * @property Goods $goods
 * @property number $price
 * @property int $attr_id
 * @property int total
 * @property Order $orderInfo
 */
class OrderGoods extends Model
{
    // 表名
    protected $name = 'order_goods';

    protected $type = [
        'delete_time' => 'timestamp:Y-m-d H:i:s',
    ];

    public function goods()
    {
        return $this->hasOne(Goods::class, 'id', 'goods_id');
    }

    public function orderInfo()
    {
        return $this->hasOne(Order::class, 'id', 'order_id');
    }

    public function attr()
    {
        return $this->hasOne(GoodsAttr::class, 'id', 'attr_id');
    }

    public function refund()
    {
        return $this->hasOne(OrderGoodsRefund2::class, 'order_goods_id', 'id');
    }

}